﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace GameEngine
{
    public class Floor : Layer
    {
        #region Attributes

        private Texture2D _collisionTexture;
        private List<Sprite> _layerContent;
        private List<Door> _doors;

        #endregion

        #region Constructor

        public Floor(Texture2D layerTexture, Vector2 startLocation, float layerScale, Texture2D collisionTexture)
            : base(layerTexture, startLocation, layerScale)
        {
            this._collisionTexture = collisionTexture;
            this._layerContent = new List<Sprite>();
            this._doors = new List<Door>();

        }

        #endregion

        #region Properties

        public Texture2D CollisionTexture
        {
            set { this._collisionTexture = value; }
            get { return this._collisionTexture; }
        }

        public List<Sprite> LayerContent {
            set { this._layerContent = value; }
            get { return this._layerContent; }
        }

        public List<Door> Doors
        {
            set { this._doors = value; }
            get { return this._doors; }
        }

        #endregion

        #region Public Methods

        public override void Update(GameTime gameTime, Vector2 playerLocation)
        {

        }
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(LayerTexture, StartLocation, new Rectangle(0, 0, LayerTexture.Width, LayerTexture.Height), Color.White);
            //spriteBatch.Draw(LayerTexture, StartLocation, new Rectangle(0, 0, LayerTexture.Width, LayerTexture.Height), Color.White, 0, Vector2.Zero, LayerScale, SpriteEffects.None, 1);
            //FloorspriteBatch.Draw(CollisionTexture, StartLocation, new Rectangle(0, 0, FloorTexture.Width, FloorTexture.Height), Color.White, 0, Vector2.Zero, LayerScale, SpriteEffects.None, 1);
            
            if (LayerContent.Count > 0)
            {
                foreach (Sprite sprite in LayerContent)
                    sprite.Draw(spriteBatch);
            }
        }

        #endregion
    }
}
